import {DataCategory} from 'sentry/types/core';
import {
  getDocsPlatformSDKForPlatform,
  getProfileDurationCategoryForPlatform,
  getProfilingDocsForPlatform,
} from 'sentry/utils/profiling/platforms';

describe('getDocsPlatformSDKForPlatform', () => {
  it.each([
    [undefined, null],
    ['android', 'android'],
    ['apple-macos', 'apple-macos'],
    ['apple-ios', 'apple-ios'],
    ['python', 'python'],
    ['python-django', 'python'],
    ['python-flask', 'python'],
    ['python-fastapi', 'python'],
    ['python-starlette', 'python'],
    ['python-sanic', 'python'],
    ['python-celery', 'python'],
    ['python-bottle', 'python'],
    ['python-pylons', 'python'],
    ['python-pyramid', 'python'],
    ['python-tornado', 'python'],
    ['python-rq', 'python'],
    ['python-awslambda', 'python'],
    ['python-azurefunctions', 'python'],
    ['python-gcpfunctions', 'python'],
    ['node', 'node'],
    ['node-awslambda', 'node'],
    ['node-azurefunctions', 'node'],
    ['node-connect', 'node'],
    ['node-express', 'node'],
    ['node-fastify', 'node'],
    ['node-gcpfunctions', 'node'],
    ['node-hapi', 'node'],
    ['node-koa', 'node'],
    ['node-nestjs', 'node'],
  ])('gets docs platform for %s', (platform, docsPlatform) => {
    expect(getDocsPlatformSDKForPlatform(platform)).toEqual(docsPlatform);
  });
});

describe('getProfilingDocsForPlatform', () => {
  it.each([
    ['android', 'https://docs.sentry.io/platforms/android/profiling/'],
    ['apple-macos', 'https://docs.sentry.io/platforms/apple/guides/macos/profiling/'],
    ['apple-ios', 'https://docs.sentry.io/platforms/apple/guides/ios/profiling/'],
    ['python', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-django', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-flask', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-fastapi', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-starlette', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-sanic', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-celery', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-bottle', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-pylons', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-pyramid', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-tornado', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-rq', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-awslambda', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-azurefunctions', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['python-gcpfunctions', 'https://docs.sentry.io/platforms/python/profiling/'],
    ['node', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-awslambda', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-azurefunctions', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-connect', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-express', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-fastify', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-gcpfunctions', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-hapi', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-koa', 'https://docs.sentry.io/platforms/node/profiling/'],
    ['node-nestjs', 'https://docs.sentry.io/platforms/node/profiling/'],
  ])('gets profiling docs for %s', (platform, docs) => {
    expect(getProfilingDocsForPlatform(platform)).toEqual(docs);
  });
});

describe('getProfileDurationCategoryForPlatform', () => {
  it.each([
    'bun',
    'deno',
    'django',
    'dotnet',
    'dotnet-aspnet',
    'dotnet-aspnetcore',
    'dotnet-awslambda',
    'dotnet-gcpfunctions',
    'dotnet-google-cloud-functions',
    'elixir',
    'go',
    'go-echo',
    'go-fasthttp',
    'go-fiber',
    'go-gin',
    'go-http',
    'go-iris',
    'go-martini',
    'go-negroni',
    'java',
    'java-appengine',
    'java-log4j',
    'java-log4j2',
    'java-logback',
    'java-logging',
    'java-spring',
    'java-spring-boot',
    'kotlin',
    'native',
    'node',
    'node-awslambda',
    'node-azurefunctions',
    'node-cloudflare-pages',
    'node-cloudflare-workers',
    'node-connect',
    'node-express',
    'node-fastify',
    'node-gcpfunctions',
    'node-hapi',
    'node-koa',
    'node-nestjs',
    'node-nodeawslambda',
    'node-nodegcpfunctions',
    'perl',
    'php',
    'PHP',
    'php-laravel',
    'php-monolog',
    'php-symfony',
    'php-symfony2',
    'powershell',
    'python',
    'python-aiohttp',
    'python-asgi',
    'python-awslambda',
    'python-azurefunctions',
    'python-bottle',
    'python-celery',
    'python-chalice',
    'python-django',
    'python-falcon',
    'python-fastapi',
    'python-flask',
    'python-gcpfunctions',
    'python-pylons',
    'python-pymongo',
    'python-pyramid',
    'python-pythonawslambda',
    'python-pythonazurefunctions',
    'python-pythongcpfunctions',
    'python-pythonserverless',
    'python-quart',
    'python-rq',
    'python-sanic',
    'python-serverless',
    'python-starlette',
    'python-tornado',
    'python-tryton',
    'python-wsgi',
    'rails',
    'ruby',
    'ruby-rack',
    'ruby-rails',
    'rust',
  ] as const)('DataCategory.PROFILE_DURATION %s', platform => {
    expect(getProfileDurationCategoryForPlatform(platform)).toEqual(
      DataCategory.PROFILE_DURATION
    );
  });

  it.each([
    'android',
    'apple',
    'apple-ios',
    'apple-macos',
    'capacitor',
    'cocoa',
    'cocoa-objc',
    'cocoa-swift',
    'cordova',
    'dart',
    'dart-flutter',
    'dotnet-maui',
    'dotnet-winforms',
    'dotnet-wpf',
    'dotnet-xamarin',
    'electron',
    'flutter',
    'godot',
    'ionic',
    'java-android',
    'javascript',
    'javascript-angular',
    'javascript-angularjs',
    'javascript-astro',
    'javascript-backbone',
    'javascript-browser',
    'javascript-capacitor',
    'javascript-cordova',
    'javascript-electron',
    'javascript-ember',
    'javascript-gatsby',
    'javascript-nextjs',
    'javascript-nuxt',
    'javascript-react',
    'javascript-react-router',
    'javascript-remix',
    'javascript-solid',
    'javascript-solidstart',
    'javascript-svelte',
    'javascript-sveltekit',
    'javascript-tanstackstart-react',
    'javascript-vue',
    'minidump',
    'native-crashpad',
    'native-breakpad',
    'native-minidump',
    'native-qt',
    'nintendo-switch',
    'objc',
    'playstation',
    'react',
    'react-native',
    'swift',
    'unity',
    'unreal',
    'xbox',
  ] as const)('DataCategory.PROFILE_DURATION_UI %s', platform => {
    expect(getProfileDurationCategoryForPlatform(platform)).toEqual(
      DataCategory.PROFILE_DURATION_UI
    );
  });

  it.each([
    'c',
    'cfml',
    'clojure',
    'csharp',
    'csharp-aspnetcore',
    'dotnet-uwp',
    'groovy',
    'scala',
    'switt',
    'other',
  ] as const)('null %s', platform => {
    expect(getProfileDurationCategoryForPlatform(platform)).toBeNull();
  });
});
